package com.osgc.rf.unit.temp;

import com.inca.np.auth.Userruninfo;
import com.osgc.rf.np.url.dao.Navigation;
import com.osgc.rf.np.url.dao.User;
import com.osgc.rf.np.url.util.Base;

public abstract class ModelBase extends Base{
	protected Navigation navigation = null;
	protected User user;
	protected Userruninfo userinfo;

	public void setInfoFileVm(String vm) {
		sessionHelper.putContext("infofilevm", vm);
	}
	abstract protected String getTemp();
	@Override
	public void beforeInvoke() throws Exception {
		navigation = (Navigation) sessionHelper.getContext("navigation");
		user = (User) sessionHelper.getContext("user");
		if (user != null) {
			userinfo = new Userruninfo();
			userinfo.setUserid(user.getUserid());
			userinfo.setUsername(user.getUsername());
			if (navigation == null) {
				navigation = new Navigation();
				sessionHelper.putContext("navigation", navigation);
			}
			navigation.setMenu(user.getOp());
		}
		setRedirect(getTemp());
	}
	public void index() {
		navigation.setId("");
		sessionHelper.remove();
		setInfoFileVm("scan");
	}
	@Override
	public void afterInvoke() throws Exception {

	}
}
